[(not(self::mml:mi) and not(self::mml:mn) and not(self::mml:mo) and not(self::mml:ms) and not(self::mml:mtext))
or
(self::mml:mi[child::mml:mglyph] or self::mml:mn[child::mml:mglyph] or self::mml:mo[child::mml:mglyph] or self::mml:ms[child::mml:mglyph] or self::mml:mtext[child::mml:mglyph])
or
not(
(($mathbackground=@mathbackground) or
((not(@mathbackground) or $mathbackground) and (not($mathbackground) or $mathbackground=''))
)
and
(($sColorPropCur=@mathcolor) or
((not(@mathcolor) or @mathcolor='') and $sColorPropCur=@color) or
((not(@mathcolor) or @mathcolor='') and (not(@color) or @color='') and ancestor::mml:mstyle[@color][1]/@color=$sColorPropCur) or
((not(@mathcolor) or @mathcolor='') and (not(@color) or @color='') and (not(ancestor::mml:mstyle[@color][1]/@color) or ancestor::mml:mstyle[@color][1]/@color='') and (not($sColorPropCur) or $sColorPropCur=''))
)
and
(($sSzCur=@mathsize) or
((not(@mathsize) or @mathsize='') and $sSzCur=@fontsize) or
((not(@mathsize) or @mathsize='') and (not(@fontsize) or @fontsize='') and (not($sSzCur) or $sSzCur=''))
)
and
((($sFontCur=@mathvariant)
or
((not(@mathvariant) or @mathvariant='') and ($sFontCur='normal') and (not(self::mml:mi) or
(@fontstyle='normal' and (not(@fontweight='bold'))) or
(string-length(normalize-space(.)) > 1)
))
or
((not(@mathvariant) or @mathvariant='') and ($sFontCur='bi') and (@fontstyle='italic' and @fontweight='bold'))
or
(($sFontCur='italic') and (((not(@mathvariant) or @mathvariant='') and
(
(@fontstyle='italic' and
(@fontweight='normal' or not(@fontweight) or @fontweight='')
)
or
((not(@fontstyle) or @fontstyle='') and (not(@fontweight)=@fontweight=''))
)
) or @mathvariant='italic'
)
)
or
(($sFontCur='bold') and (((not(@mathvariant) or @mathvariant='') and @fontweight='bold' and (@fontstyle='normal' or not(@fontstyle) or @fontstyle='')) or @mathvariant='bold'))
or
(($sFontCur='' and (((not(@mathvariant) or @mathvariant='') and (not(@fontstyle) or @fontstyle='') and (not(@fontweight)or @fontweight='')) or
(@mathvariant='italic') or
((not(@mathvariant) or @mathvariant='') and @fontweight='normal' and @fontstyle='italic') or
((not(@mathvariant) or @mathvariant='') and (not(@fontweight) or @fontweight='') and @fontstyle='italic') or
((not(@mathvariant) or @mathvariant='') and (not(@fontweight) or @fontweight='') and (not(@fontstyle) or @fontweight=''))
)
))
or
($sFontCur='normal' and
(self::mml:mi and
(not(@mathvariant) or @mathvariant='') and
(not(@fontstyle) or @fontstyle='') and
(not(@fontweight) or @fontweight='') and
string-length(normalize-space(.)) > 1
)
or
( (self::mml:ms or self::mml:mtext) and
(not(@mathvariant) or @mathvariant='') and
(not(@fontstyle) or @fontstyle) and
(not(@fontweight) or @fontweight)
)
))
and not( (not(@mathvariant) or @mathvariant='') and
(not(@fontstyle) or @fontstyle='') and
(not(@fontweight) or @fontweight='') and
((self::mml:mi and (string-length(normalize-space(.)) > 1)) or self::mml:ms or self::mml:mtext) and
($sFontCur!='normal') )
)
and
(($font-family=@font-family) or
((not(@font-family) or @font-family) and (not($font-family) or $font-family=''))
<xsl:with-param name="index" select="floor($index div 16)" />
</xsl:call-template>
<xsl:choose>
<xsl:when test="$index mod 16 < 10">
<xsl:value-of select="$index mod 16" />
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$index mod 16 = 10">A</xsl:when>
<xsl:when test="$index mod 16 = 11">B</xsl:when>
<xsl:when test="$index mod 16 = 12">C</xsl:when>
<xsl:when test="$index mod 16 = 13">D</xsl:when>
<xsl:when test="$index mod 16 = 14">E</xsl:when>
<xsl:when test="$index mod 16 = 15">F</xsl:when>
<xsl:otherwise>A</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="mml:mphantom">
<m:phant>
<m:phantPr>
<m:width m:val="on" />
<m:asc m:val="on" />
<m:dec m:val="on" />
</m:phantPr>
<m:e>
<xsl:apply-templates select="*" />
</m:e>
</m:phant>
</xsl:template>
<xsl:template name="isNaryOper">
<xsl:param name="sNdCur" />
<xsl:value-of select="($sNdCur = '∫' or $sNdCur = '∬' or $sNdCur = '∭' or $sNdCur = '∮' or $sNdCur = '∯' or $sNdCur = '∰' or $sNdCur = '∲' or $sNdCur = '∳' or $sNdCur = '∱' or $sNdCur = '∩' or $sNdCur = '∪' or $sNdCur = '∏' or $sNdCur = '∐' or $sNdCur = '∑')" />
</xsl:template>
<xsl:template name="isNary">
<xsl:param name="ndCur" />
<xsl:variable name="sNdCur">
<xsl:value-of select="normalize-space($ndCur)" />
</xsl:variable>
<xsl:variable name="fNaryOper">
<xsl:call-template name="isNaryOper">
<xsl:with-param name="sNdCur" select="$sNdCur" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name($ndCur/descendant-or-self::*[last()]) = 'mo' and
not($ndCur/descendant-or-self::*[not(self::mml:mo or
self::mml:mstyle or
self::mml:mrow)]) and
namespace-uri($ndCur/descendant-or-self::*[last()]) = 'http://www.w3.org/1998/Math/MathML' and